from rest_framework import serializers
from .models import Good


class GoodSuperSerializer(serializers.ModelSerializer):
    isDiscount = serializers.DecimalField(max_digits=19, decimal_places=2)

    class Meta:
        model = Good
        fields = '__all__'

    def create(self, validated_data):
        print(validated_data['name'])
        return super().create(validated_data)


class GoodAllowSerializer(serializers.ModelSerializer):
    isDiscount = serializers.DecimalField(max_digits=19, decimal_places=2)

    class Meta:
        model = Good
        fields = ('name', 'isDiscount', 'price')
